package com.xxxx.server.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author:王亚栋
 * @Date: 2023/6/11 下午8:59
 * @Version:1.0
 * 公共返回对象
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {

    private long code;

    private String message;

    private Object obj;

    /**
     * 返回成功结果
     * @param message
     * @return
     */
    public static RespBean success(String message){

        return new RespBean(200,message,null);
    }

    /**
     * 返回成功结果
     * @param message
     * @return
     */
    public static RespBean success(String message,Object obj){

        return new RespBean(200,message,obj);

    }

    /**
     * 返回错误结果
     * @param message
     * @param obj
     * @return
     */
    public static RespBean error(String message,Object obj){

        return new RespBean(500,message,obj);

    }

    public static RespBean error(String message){

        return new RespBean(500,message,null);

    }
}
